import request from '@/utils/request'

export function tagTreeData(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/question/tags/treeData`,
    method: 'post',
    data: query
  })
}

export function tagSave(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/question/tags/save`,
    method: 'post',
    data: query
  })
}

export function tagDelete(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/question/tags/delete`,
    method: 'post',
    data: query
  })
}

export function questionTable(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/question/table`,
    method: 'post',
    data: query
  })
}

export function questionLoad(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/question/load`,
    method: 'get',
    params: query
  })
}

export function questionPreview(id, resort = false) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/question/preview/${id}`,
    method: 'get',
    params: {
      resort: resort
    }
  })
}

export function questionSave(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/question/save`,
    method: 'post',
    contentType: 'json',
    data: query
  })
}

export function questionDelete(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/question/delete`,
    method: 'post',
    data: query
  })
}

export function questionAnswer(questionId) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/question/answer/${questionId}`,
    method: 'post'
  })
}

export function examList(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/list`,
    method: 'post',
    data: query
  })
}

export function examQuestionTable(examId, query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/question/tableExam/${examId}`,
    method: 'post',
    data: query
  })
}

export function examSelectQuestionTable(examId, query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/question/selectExam/${examId}`,
    method: 'post',
    data: query
  })
}

export function examQuestionAdd(examId, query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/question/addExam/${examId}`,
    method: 'post',
    data: query
  })
}

export function examQuestionDelete(examId, query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/question/deleteExam/${examId}`,
    method: 'post',
    data: query
  })
}

export function examSave(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/save`,
    method: 'post',
    data: query
  })
}

export function examDelete(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/delete`,
    method: 'post',
    data: query
  })
}

export function examPreview(id) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/preview/${id}`,
    method: 'post'
  })
}

export function examScore(query) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/score`,
    method: 'post',
    contentType: 'json',
    data: query
  })
}

export function examCert(id) {
  return request({
    url: `${process.env.VUE_APP_MODULE_BLOG_API}/api/training/exam/cert/${id}`,
    method: 'post'
  })
}
